import { message } from "antd";
import React from "react";
import { history } from "umi";
import loginPng from "@/assets/imgs/login.png";
import { TOKEN, PROJECT_NAME } from "@/constants";
import { getItem } from "@/utils/localstorage";
import styles from "../style.less";
import logoPng from "@/assets/imgs/logoWhite.png";
import LoginForm from "./loginForm";
message.config({
  maxCount: 1,
});

const Login: React.FC = () => {
  if (getItem(TOKEN)) {
    history.replace("/welcome");
  }
  return (
    <div className={styles.FindBox}>
      <div className={styles.lefgBg} style={{ background: "#005EFE" }}>
        <div className={styles.leftHeader}>
          <img src={logoPng} alt="" />
          <span style={{ color: "#ffffff" }}>{PROJECT_NAME}</span>
          <img className={styles.headerBg} src={loginPng} alt="" />
        </div>
      </div>
      <div style={{ padding: "0 80px", width: "100%" }}>
        <div className={styles.content}>
          <LoginForm />
        </div>
      </div>
    </div>
  );
};

export default Login;
